import ajax from "./request"
import mockRequest from './MockAjax';

// 获取商品的三级分类列表
export const reqBaseCategoryList = () => ajax.get('/product/getBaseCategoryList')

// 获取广告轮播图列表
export const reqBannerList = () => mockRequest.get("/banner")

//获取首页楼层列表
export const reqFloorList = () => mockRequest.get("/floor")

// 搜索商品
export const reqProductList = (searchParams) => ajax.post("/list", searchParams)

// 商品详情页
export const reqDetailInfo = (skuId) => ajax.get(`/item/${skuId}`)

// 将产品添加到购物车中
export const reqAddOrUpdateShopCart = (skuId, skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)

//获取购物车列表
export const reqShopCartList = () => ajax.get(`/cart/cartList`)

// 删除购物车列表商品
export const reqDeleteCart = (skuId) => ajax.delete(`/cart/deleteCart/${skuId}`)

//切换商品选中状态
export const reqCheckCart = (skuID, isChecked) => ajax.get(`/cart/checkCart/${skuID}/${isChecked}`)

// 登录请求
export const reqLogin = (data) => ajax.post(`/user/passport/login`, data)

// 注册
export const reqRegister = (data) => ajax.post(`/user/passport/register`, data)

// 退出登录
export const reqLogout = () => ajax.get(`/user/passport/logout`)

// 获取验证码 /api/user/passport/sendCode/{phone}
export const reqCode = (phone) => ajax.get(`/user/passport/sendCode/${phone}`)

// 获取用户信息
export const reqUserInfo = () => ajax.get(`/user/passport/auth/getUserInfo`)

// 获取用户地址
export const reqAddressInfo = () => ajax.get(`/user/userAddress/auth/findUserAddressList`)

// 获取商品订单
export const reqOrderInfo = () => ajax.get(`/order/auth/trade`)

// 提交订单
export const reqSubmitOrder = (tradeNo, data) => ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, data)

// 获取订单支付信息
export const reqPayInfo = (orderId) => ajax.get(`/payment/weixin/createNative/${orderId}`)

// 获取订单列表
export const reqOderList = (page, limit) => ajax.get(`/order/auth/${page}/${limit}`)
